/******************************************************************************
 *
 * $RCSfile$
 * $Revision: 124 $
 *
 * This module provides the interface definitions for setting up and
 * controlling the various interrupt modes present on the ARM processor.
 * Copyright 2004, R O SoftWare
 * No guarantees, warrantees, or promises, implied or otherwise.
 * May be used for hobby or commercial purposes provided copyright
 * notice remains intact.
 *
 *****************************************************************************/
#ifndef OLED_H
#define OLED_H

#include "main.h"

#define OLED_END                127

#define PADDLE_THICKNESS	0x02
#define PADDLE_HEIGHT		0x18
#define PADDLE_X_OFFSET		0x02
#define PADDLE_START		OLED_END-PADDLE_THICKNESS/2
#define BALL_X_START		60
#define BALL_Y_START		60
#define BALL_THICKNESS		5

#define PONG_TOP		15
#define PONG_SCORE_TOP		(PONG_TOP - 12)

#define COMPUTER	0
#define PLAYER		1

#define PLAYER_MAX_SPD		0x07
#define COMPUTER_MAX_SPD	0x05
#define BALL_MAX_SPD		0x08


// inialize OLED
void OLED_init      ( void );
void OLED_ShutDown  ( void );
void OLED_TurnOn    ( void );
void Reset_SSD1339  ( void );
void ClearScreen    ( void );
void UpdateScreen   ( void );
void ClearWindow    ( uint8_t x1,
                    uint8_t y1, 
                    uint8_t x2, 
                    uint8_t y2 );
void BufferToScreen ( uint8_t x_start,
                    uint8_t y_start,
                    uint8_t x_end, 
                    uint8_t y_end );

void Draw_8x12_string ( uint8_t* str,
                      uint8_t len,
                      int16_t x_start,
                      int16_t y_start,
                      uint8_t clr,
                      spPoint2D_t p1,
                      spPoint2D_t p2 );

void Draw_5x8_string  ( uint8_t* str,
                      uint8_t len,
                      int16_t x_start,
                      int16_t y_start,
                      uint8_t clr,
                      spPoint2D_t p1,
                      spPoint2D_t p2 );

void DrawRectangle    ( uint8_t xLeft, 
                      uint8_t yTop, 
                      uint8_t xRight, 
                      uint8_t yBottom, 
                      uint8_t clrOutline, 
                      uint8_t clrFill );

void DrawLine         ( int16_t xLeft, 
                      int16_t yTop, 
                      int16_t xRight, 
                      int16_t yBottom, 
                      uint8_t clrFill );

void DrawLineFill     ( int16_t xLeft, 
                      int16_t yTop, 
                      int16_t xRight, 
                      int16_t yBottom, 
                      uint8_t clrLine, 
                      uint8_t clrFill );

void circle           ( int16_t cx, 
                      int16_t cy, 
                      int16_t radius, 
                      uint8_t clroutline,
                      uint8_t clrfill ); 

extern uint8_t* ucpDispBuff;

#endif
